org.eclipse.vtp.framework.interactions.voice.vxml
Class Field

java.lang.Object
  extended by org.eclipse.vtp.framework.interactions.core.support.Widget
      extended by org.eclipse.vtp.framework.interactions.voice.vxml.FormElement
          extended by org.eclipse.vtp.framework.interactions.voice.vxml.Field
All Implemented Interfaces:
VXMLConstants

public class Field
extends FormElement

The Field class represents the <field> VXML element. Each field within a Form element can have an initial prompt that is played to the caller when the field is first entered during processing. A field can be allow free-form entry of digits or a DTMF grammar can provided to validate the entry. A field can also have a set of options that the caller input is matched against. Be aware that field options do NOT support the use of the AudioOutput element.

As a named element of a form, its value can be used in ValueOutput and Script elements or returned to the IVR system with the Submit action.

Version:
1.0
Author:
Trip Gilman

Field Summary
 
Fields inherited from interface org.eclipse.vtp.framework.interactions.voice.vxml.VXMLConstants
EMPTY, FILE_EXT_GSL, FILLED_MODE_ALL, FILLED_MODE_ANY, GRAMMAR_MODE_DTMF, GRAMMAR_MODE_VOICE, METHOD_GET, METHOD_POST, MIME_TYPE_GSL, MIME_TYPE_SRGS, NAME_APPLICATION, NAME_ASSIGN, NAME_AUDIO, NAME_BARGEIN, NAME_BEEP, NAME_BLOCK, NAME_BRIDGE, NAME_CATCH, NAME_CHOICE, NAME_COMPLETETIMEOUT, NAME_COND, NAME_CONFIDENCELEVEL, NAME_COUNT, NAME_DEST, NAME_DISCONNECT, NAME_DTMF, NAME_DTMFTERM, NAME_ELSE, NAME_ELSEIF, NAME_ENCTYPE, NAME_ENUMERATE, NAME_ERROR, NAME_EVENT, NAME_EVENTEXPR, NAME_EXIT, NAME_EXPR, NAME_FIELD, NAME_FILLED, NAME_FINALSILENCE, NAME_FORM, NAME_GOTO, NAME_GRAMMAR, NAME_ID, NAME_IF, NAME_INCOMPLETETIMEOUT, NAME_INPUTMODES, NAME_INTERDIGITTIMEOUT, NAME_ITEM, NAME_MAXNBEST, NAME_MAXSPEECHTIMEOUT, NAME_MAXTIME, NAME_MENU, NAME_METHOD, NAME_MODE, NAME_NAME, NAME_NAMELIST, NAME_NEXT, NAME_NOINPUT, NAME_NOMATCH, NAME_ONE_OF, NAME_OPTION, NAME_PARAM, NAME_PROMPT, NAME_PROPERTY, NAME_RECORD, NAME_REPEAT, NAME_REPROMPT, NAME_RETURN, NAME_ROOT, NAME_RULE, NAME_SCOPE, NAME_SCRIPT, NAME_SENSITIVITY, NAME_SPEEDVSACCURACY, NAME_SRC, NAME_SUBDIALOG, NAME_SUBMIT, NAME_TERMCHAR, NAME_TERMTIMEOUT, NAME_THROW, NAME_TIMEOUT, NAME_TRANSFER, NAME_TYPE, NAME_VALUE, NAME_VAR, NAME_VERSION, NAME_VXML, NAMESPACE_URI_VXML, QNAME_XML_LANG, SCOPE_DIALOG, SCOPE_DOCUMENT, TYPE_CDATA, VERSION_2_0
 
Constructor Summary
Field(java.lang.String name)
          Creates a new instance of Field with the specified name.
Field(java.lang.String name, Prompt prompt)
          Creates a new instance of Field with the specified name and opening prompt.
Field(java.lang.String name, java.lang.String expression)
          Creates a new instance of Field with the specified name.
Field(java.lang.String name, java.lang.String expression, Prompt prompt)
          Creates a new instance of Field with the specified name and opening prompt.
Field(java.lang.String name, java.lang.String expression, java.lang.String condition)
          Creates a new instance of Field with the specified name.
Field(java.lang.String name, java.lang.String expression, java.lang.String condition, Prompt prompt)
          Creates a new instance of Field with the specified name and opening prompt.
 
Method Summary
 void addEventHandler(EventHandler eventHandler)
          Adds the specified event handler to this field.
 void addFilledHandler(Filled filled)
          Adds the specified filled handler to this field.
 void addGrammar(Grammar grammar)
          Specifies the DTMF grammar to match the caller's entered digits against.
 void addOption(Option option)
          Adds the specified option to the set of available options for this field.
 void clearProperty(java.lang.String propertyName)
          Clears the value of a property in this field.
 EventHandler[] getEventHandlers()
          Returns the list of event handlers for this field.
 Filled[] getFilledHandlers()
          Returns the list of filled handlers for this field.
 Grammar[] getGrammar()
          Returns the DTMF grammar to apply to the caller's input.
 Option[] getOptions()
          Returns the list of options for this field.
 Prompt getPrompt()
          Returns the opening prompt to play to the caller.
 java.lang.String[] getPropertyNames()
          Returns the names of the properties of this field.
 java.lang.String getPropertyValue(java.lang.String propertyName)
          Returns the value of the specified property or null if no such property exists.
 java.lang.String getType()
          Returns the type of the field.
 void removeEventHandler(EventHandler eventHandler)
          Removes the specified event handler from this field.
 void removeFilledHandler(Filled filled)
          Removes the specified filled handler from this field.

NOTE: A filled handler element that is added to a field must NOT specify a mode.
 void removeOption(Option option)
          Removes the specified option from the set of available options for this field.
 void setPrompt(Prompt prompt)
          Sets the opening prompt to the specified Prompt.
 void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
          Sets the value of a property in this field.
 void setType(java.lang.String type)
          Sets the type of the field.
protected  void writeAttributes(org.xml.sax.helpers.AttributesImpl attributes)
          Write the attribute members of this form element to the supplied set.
protected  void writeEventHandlers(org.xml.sax.ContentHandler outputHandler)
          Write the event handlers of this field to the specified content handler.
protected  void writeFilledHandlers(org.xml.sax.ContentHandler outputHandler)
          Write the filled handlers of this field to the specified content handler.
protected  void writeGrammar(org.xml.sax.ContentHandler outputHandler)
          Writes this field's grammar to the specified content handler.
protected  void writeOptions(org.xml.sax.ContentHandler outputHandler)
          Write the options in this field to the specified content handler.
protected  void writePrompt(org.xml.sax.ContentHandler outputHandler)
          Writes this field's prompt to the specified content handler.
protected  void writeProperties(org.xml.sax.ContentHandler outputHandler)
          Writes the properties of this field to the specified content handler.
 void writeWidget(org.xml.sax.ContentHandler outputHandler)
          Writes the content of this widget to an XML content handler.
 
Methods inherited from class org.eclipse.vtp.framework.interactions.voice.vxml.FormElement
getCondition, getExpression, getName, setCondition, setExpression, setName
 
Methods inherited from class org.eclipse.vtp.framework.interactions.core.support.Widget
toString, writeAttribute, writeChildren, writeChildren, writeWidget, writeWidget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Field

public Field(java.lang.String name)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of Field with the specified name. The sets of options, event handlers, filled handlers, and properties are initially empty. No opening prompt is provided, and no DTMF grammar is applied.

Parameters:
name - The name this field will be referred to by.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.NullPointerException - If the specified name is null.

Field

public Field(java.lang.String name,
             Prompt prompt)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of Field with the specified name and opening prompt. The sets of options, event handlers, filled handlers, and properties are initially empty. No DTMF grammar is applied.

Parameters:
name - The name this field will be referred to by.
prompt - The opening prompt played to the caller.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.NullPointerException - If the specified name is null.

Field

public Field(java.lang.String name,
             java.lang.String expression)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of Field with the specified name. The sets of options, event handlers, filled handlers, and properties are initially empty. No opening prompt is provided, and no DTMF grammar is applied.

Parameters:
name - The name this field will be referred to by.
expression - See the documentation for FormElement.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.IllegalArgumentException - If the specified expression is empty.
java.lang.NullPointerException - If the specified name is null.

Field

public Field(java.lang.String name,
             java.lang.String expression,
             Prompt prompt)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of Field with the specified name and opening prompt. The sets of options, event handlers, filled handlers, and properties are initially empty. No DTMF grammar is applied.

Parameters:
name - The name this field will be referred to by.
expression - See the documentation for FormElement.
prompt - The opening prompt played to the caller.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.IllegalArgumentException - If the specified expression is empty.
java.lang.NullPointerException - If the specified name is null.

Field

public Field(java.lang.String name,
             java.lang.String expression,
             java.lang.String condition)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of Field with the specified name. The sets of options, event handlers, filled handlers, and properties are initially empty. No opening prompt is provided, and no DTMF grammar is applied.

Parameters:
name - The name this field will be referred to by.
expression - See the documentation for FormElement.
condition - See the documentation for FormElement.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.IllegalArgumentException - If the specified expression is empty.
java.lang.IllegalArgumentException - If the specified condition is empty.
java.lang.NullPointerException - If the specified name is null.

Field

public Field(java.lang.String name,
             java.lang.String expression,
             java.lang.String condition,
             Prompt prompt)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of Field with the specified name and opening prompt. The sets of options, event handlers, filled handlers, and properties are initially empty. No DTMF grammar is applied.

Parameters:
name - The name this field will be referred to by.
expression - See the documentation for FormElement.
condition - See the documentation for FormElement.
prompt - The opening prompt played to the caller.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.IllegalArgumentException - If the specified expression is empty.
java.lang.IllegalArgumentException - If the specified condition is empty.
java.lang.NullPointerException - If the specified name is null.
Method Detail

getType

public java.lang.String getType()
Returns the type of the field.

Returns:
The type of the field.

getPrompt

public Prompt getPrompt()
Returns the opening prompt to play to the caller.

Returns:
the opening prompt to play to the caller.

getGrammar

public Grammar[] getGrammar()
Returns the DTMF grammar to apply to the caller's input.

Returns:
the DTMF grammar to apply to the caller's input.

getPropertyNames

public java.lang.String[] getPropertyNames()
Returns the names of the properties of this field.

Returns:
The names of the properties of this field.

getPropertyValue

public java.lang.String getPropertyValue(java.lang.String propertyName)
                                  throws java.lang.NullPointerException
Returns the value of the specified property or null if no such property exists.

Parameters:
propertyName - The name of the property to find the value of.
Returns:
The value of the specified property or null if no such property exists.
Throws:
java.lang.NullPointerException - If the supplied property name is null.

getOptions

public Option[] getOptions()
Returns the list of options for this field.

Returns:
The list of options for this field.

getFilledHandlers

public Filled[] getFilledHandlers()
Returns the list of filled handlers for this field.

Returns:
The list of filled handlers for this field.

getEventHandlers

public EventHandler[] getEventHandlers()
Returns the list of event handlers for this field.

Returns:
The list of event handlers for this field.

setType

public void setType(java.lang.String type)
Sets the type of the field.

Parameters:
type - The type of the field.

setPrompt

public void setPrompt(Prompt prompt)
Sets the opening prompt to the specified Prompt.

Parameters:
prompt - The new opening prompt to be played to the caller.

addGrammar

public void addGrammar(Grammar grammar)
Specifies the DTMF grammar to match the caller's entered digits against. If the input does not conform to the rules of the grammar, a "nomatch" event is generated.

Parameters:
grammar - The DTMF grammar to apply to the caller's input.

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String propertyValue)
                 throws java.lang.NullPointerException
Sets the value of a property in this field.

Parameters:
propertyName - The name of the property to set.
propertyValue - The value to set the property to.
Throws:
java.lang.NullPointerException - If the supplied property name or value is null.

clearProperty

public void clearProperty(java.lang.String propertyName)
                   throws java.lang.NullPointerException
Clears the value of a property in this field.

Parameters:
propertyName - The name of the property to clear.
Throws:
java.lang.NullPointerException - If the supplied property name is null.

addOption

public void addOption(Option option)
               throws java.lang.NullPointerException
Adds the specified option to the set of available options for this field. The options will be enumerated to the caller and matched against the input in the order they were added.

Parameters:
option - The option to add.
Throws:
java.lang.NullPointerException - If the supplied option is null.

removeOption

public void removeOption(Option option)
                  throws java.lang.NullPointerException
Removes the specified option from the set of available options for this field. The options will be enumerated to the caller and matched against the input in the order they were added.

Parameters:
option - The option to remove.
Throws:
java.lang.NullPointerException - If the supplied option is null.

addFilledHandler

public void addFilledHandler(Filled filled)
                      throws java.lang.NullPointerException
Adds the specified filled handler to this field. The filled handlers will be executed in the order they were added.

NOTE: A filled handler element that is added to a field must NOT specify a mode. Although this caveat is not mentioned in the w3c spec, many implementations do not allow mode to be declared in this situation.

Parameters:
filled - The filled handler to be added.
Throws:
java.lang.NullPointerException - If the supplied filled handler is null.

removeFilledHandler

public void removeFilledHandler(Filled filled)
                         throws java.lang.NullPointerException
Removes the specified filled handler from this field.

NOTE: A filled handler element that is added to a field must NOT specify a mode. Although this caveat is not mentioned in the w3c spec, many implementations do not allow mode to be declared in this situation.

Parameters:
filled - The filled handler to be removed.
Throws:
java.lang.NullPointerException - If the supplied filled handler is null.

addEventHandler

public void addEventHandler(EventHandler eventHandler)
                     throws java.lang.NullPointerException
Adds the specified event handler to this field. The event handlers are evaluated in the order they were added.

Parameters:
eventHandler - The event handler to add.
Throws:
java.lang.NullPointerException - If the supplied event handler is null.

removeEventHandler

public void removeEventHandler(EventHandler eventHandler)
                        throws java.lang.NullPointerException
Removes the specified event handler from this field.

Parameters:
eventHandler - The event handler to remove.
Throws:
java.lang.NullPointerException - If the supplied event handler is null.

writeWidget

public void writeWidget(org.xml.sax.ContentHandler outputHandler)
                 throws java.lang.NullPointerException,
                        org.xml.sax.SAXException
Description copied from class: Widget
Writes the content of this widget to an XML content handler.

Specified by:
writeWidget in class Widget
Parameters:
outputHandler - The handler to write this widget to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of this widget fails.

writeAttributes

protected void writeAttributes(org.xml.sax.helpers.AttributesImpl attributes)
Description copied from class: FormElement
Write the attribute members of this form element to the supplied set.

Overrides:
writeAttributes in class FormElement
Parameters:
attributes - The attribute set to write to.

writePrompt

protected void writePrompt(org.xml.sax.ContentHandler outputHandler)
                    throws java.lang.NullPointerException,
                           org.xml.sax.SAXException
Writes this field's prompt to the specified content handler.

Parameters:
outputHandler - The handler to write the prompt to.
Throws:
org.xml.sax.SAXException - If the writing of the prompt fails.
java.lang.NullPointerException - If the supplied content handler is null.

writeGrammar

protected void writeGrammar(org.xml.sax.ContentHandler outputHandler)
                     throws java.lang.NullPointerException,
                            org.xml.sax.SAXException
Writes this field's grammar to the specified content handler.

Parameters:
outputHandler - The handler to write the properties to.
Throws:
org.xml.sax.SAXException - If the writing of the grammar fails.
java.lang.NullPointerException - If the supplied content handler is null.

writeProperties

protected void writeProperties(org.xml.sax.ContentHandler outputHandler)
                        throws java.lang.NullPointerException,
                               org.xml.sax.SAXException
Writes the properties of this field to the specified content handler.

Parameters:
outputHandler - The handler to write the properties to.
Throws:
org.xml.sax.SAXException - If the writing of the properties fails.
java.lang.NullPointerException - If the supplied content handler is null.

writeOptions

protected void writeOptions(org.xml.sax.ContentHandler outputHandler)
                     throws java.lang.NullPointerException,
                            org.xml.sax.SAXException
Write the options in this field to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the options fails.

writeFilledHandlers

protected void writeFilledHandlers(org.xml.sax.ContentHandler outputHandler)
                            throws java.lang.NullPointerException,
                                   org.xml.sax.SAXException
Write the filled handlers of this field to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the filled handlers fails.

writeEventHandlers

protected void writeEventHandlers(org.xml.sax.ContentHandler outputHandler)
                           throws java.lang.NullPointerException,
                                  org.xml.sax.SAXException
Write the event handlers of this field to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the event handlers fails.